package com.database.common;

import org.slf4j.Logger;

import com.database.common.result.CommonResult;

public class ControllerErrorProcessor {

    public static CommonResult exceptionProcessor(Exception ex, Logger logger) {
        if (ex instanceof ResponseException) {
            ResponseException re = (ResponseException) ex;
            logger.warn("操作失败:" + re.getExceptionEnums().toString());
            return ResponseException.buildException(re);
        } else {
            logger.error("系统异常:" + ex.getMessage());
            return ResponseException.buildException(new ResponseException(
                BaseResultCodeEnum.ERR_CODE_00000));
        }
    }
}
